﻿namespace DivisibleMagics
{
    using System;
    using System.Linq;
    using ExtensionMethods;

    public class MainDivisibleMagics
    {
        //// 1.2.16.06. Write a program that prints from given array of integers all numbers that are divisible by 7 and 3.
        //// Use the built-in extension methods and lambda expressions. Rewrite the same with LINQ.

        private static void Main()
        {
            int[] sample = new int[] { 1, 2, 3, 5, 12, 1, 21, 18, 7, 3, 35, 42, 84, 168, 147 };

            var lambaExample = sample.Where(x => x % 3 == 0 && x % 7 == 0);
            lambaExample.PrintCollection();

            MainExtensionMethods.Separator();

            var linqExample =
                from x in sample
                where x % 3 == 0 // where x % 3 == 0 && x % 7 == 0
                where x % 7 == 0
                select x;

            linqExample.PrintCollection();
        }
    }
}